﻿@model MVCDemoEF.Models.Employee
@{
    ViewBag.Title = "Edit";
}
<div style="font-family: Arial">
    <h2>
        Edit</h2>
    @using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)

        <fieldset>
            <legend>Employee</legend>
            @Html.HiddenFor(model => model.EmployeeId)
            <div class="editor-label">
                @Html.LabelFor(model => model.Name)
            </div>
            <div class="editor-field">
                @Html.DisplayFor(model => model.Name)
                @Html.HiddenFor(model => model.Name)
                @Html.ValidationMessageFor(model => model.Name)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.Gender)
            </div>
            <div class="editor-field">
                @Html.DropDownList("Gender", new List<SelectListItem>
           {
               new SelectListItem{Text="Male",Value="Male"},
               new SelectListItem{Text="Female",Value="Female"}               
           }, "-- Select Gender --")
                @Html.ValidationMessageFor(model => model.Gender)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.City)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.City)
                @Html.ValidationMessageFor(model => model.City)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.DepartmentId, "Department")
            </div>
            <div class="editor-field">
                @Html.DropDownList("DepartmentId", "--Select Department--")
                @Html.ValidationMessageFor(model => model.DepartmentId)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.DateOfBirth)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.DateOfBirth)
                @Html.ValidationMessageFor(model => model.DateOfBirth)
            </div>
            <p>
                <input type="submit" value="Save" />
            </p>
        </fieldset>
    }
    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
</div>
